<?php
/** 
 * Created by RisingSun. 
 * User: MarkSpace 
 * Date: 20210822
 * Time: 11:05 
 * 协议管理
 */
namespace app\api\model;

use app\api\model\Model;

class Contract extends Model{
	
    private $contractcate = 'sys_contractcate';

    /**
     * 协议合同模板列表
     * @param array $catelist 
     * @param array $where 
     */ 
    public function cate($where=null, $page=1, $page_size=10, $field='a.*'){
        //類別列表
        $catelist['data']= Model::name($this->contractcate)
            ->alias('a')
            ->field($field)
            ->limit(($page-1)*$page_size,$page_size)
            ->where($where)
            ->order('id asc')
            ->select()
            ->toArray();
        //数据总数
        $catelist['total']=Model::name($this->contractcate)
            ->alias('a')
            ->where($where)
            ->count('id');
        return $catelist; 
    }

}
